package com.xunce.xcworkservice.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.util.List;

/**
 * @ClassName:  Menus  
 * @Author:     yanlong.guo      
 * @Date:       2023/12/28 16:21   
 */

@Schema(description = "菜单表")
@Data
@TableName(value = "menus")
public class Menus {
    /**
     * 主键，菜单ID，唯一标识
     */
    @TableId(value = "menu_id", type = IdType.AUTO)
    @Schema(description = "主键，菜单ID，唯一标识")
    private Integer menuId;

    /**
     * 菜单名
     */
    @TableField(value = "`name`")
    @Schema(description = "菜单名")
    @NotBlank(message = "菜单名称不能为空")
    private String name;

    /**
     * 是否为菜单，1-是，0-否
     */
    @TableField(value = "is_menu")
    @Schema(description = "是否为菜单，1-是，0-否")
    @NotNull(message = "菜单类型不能为空")
    private Byte isMenu;

    /**
     * 父级菜单ID，顶级菜单此项为0
     */
    @TableField(value = "pid")
    @Schema(description = "父级菜单ID，顶级菜单此项为0")
    private Integer pid;

    @TableField(value = "weight")
    @Schema(description = "排序 从小到大")
    private Integer weight;

    @TableField(value = "permission")
    @Schema(description = "权限名")
    private String permission;

    @TableField(exist = false)
    @Schema(description = "子集列表 添加编辑忽略")
    private List<Menus> children;
}